#ifndef DW_SYSTEM_WINDOWS_MANAGER_H
#	define DW_SYSTEM_WINDOWS_MANAGER_H

#include "base/singleton.h"

namespace dw {
	namespace system {

class Window;

class WindowsManager
:	public dw::base::Singleton< WindowsManager >
{
public : //! @name Commands
	//! @{
	void handleEvents();
	//! @}

protected : //! @name Construction & destruction
	//! @{
	WindowsManager();
	~WindowsManager();
	//! @}

protected : //! @name Commands
	//! @{
	void registerWindow(Window* window);
	void unregisterWindow(Window* window);

	static HRESULT CALLBACK windowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
	//! @}

private : //! @name Helpers
	//! @{
	Window* getWindow(HWND hWnd);
	//! @}

protected : //! @name Friends
	//! @{
	friend class dw::base::Singleton< WindowsManager >;
	friend class Window;
	//! @}

private : //! @name Data
	//! @{
	typedef std::vector< Window* > WindowsCollection;

	WindowsCollection _windows;
	//! @}
};

	} // namespace system
} // namespace dw

#endif // !DW_SYSTEM_WINDOWS_MANAGER_H
